#define _CRT_SECURE_NO_WARNINGS 1

#include <iostream>
#include <string>
using namespace std;

int main() {
    string s;
    getline(cin, s);
    int end = s.size() - 1;
    int res = 0;
    while (end > 0 && s[end] == ' ')
    {
        end--;
    }

    while (end >= 0 && s[end] != ' ') {
        res++;
        end--;
    }
    cout << res;
    return 0;
}
